<?php

use think\facade\Route;

Route::group('/', function () {
    // 不需要登录验证的路由
    Route::post('login', 'Login/login');
    Route::get('logout', 'Login/logout');
})->middleware(['log']);

// 需要登录验证的路由组
Route::group('/', function () {
    // 用户信息
    Route::get('userInfo', 'UserInfo/index');

    // 管理员管理
    Route::group('admin', function () {
        Route::get('getList', 'Admin/getList');
        Route::post('doAdd', 'Admin/doAdd');
        Route::post('doEdit', 'Admin/doEdit');
        Route::post('doDelete', 'Admin/doDelete');
    });

    // 路由管理
    Route::group('router', function () {
        Route::get('getList', 'Router/getList');
    });

    // 角色管理
    Route::group('role', function () {
        Route::get('getList', 'Role/getList');
        Route::post('doAdd', 'Role/doAdd');
        Route::post('doEdit', 'Role/doEdit');
        Route::post('doDelete', 'Role/doDelete');
    });

    // 菜单管理
    Route::group('menu', function () {
        Route::get('getList', 'Menu/getList');
        Route::post('doAdd', 'Menu/doAdd');
        Route::post('doEdit', 'Menu/doEdit');
        Route::post('doDelete', 'Menu/doDelete');
        Route::get('getRouters', 'Menu/getRouters');
    });

    // 操作日志管理
    Route::group('operationLog', function () {
        Route::get('getList', 'OperationLog/getList');
        Route::get('getDetail', 'OperationLog/getDetail');
    });

    // OSS 文件管理路由组
    Route::group('oss', function () {
        Route::post('upload', 'Oss/upload');
        Route::get('getList', 'Oss/getList');
        Route::post('delete', 'Oss/delete');
        Route::post('deleteDir', 'Oss/deleteDir');
        Route::post('createFolder', 'Oss/createFolder');
        Route::get('getDownloadUrl', 'Oss/getDownloadUrl');
        Route::get('getFolderInfo', 'Oss/getFolderInfo');
        Route::get('getFileInfo', 'Oss/getFileInfo');
        Route::get('getPreviewUrl', 'Oss/getPreviewUrl');
    });

    // 语言管理
    Route::group('language', function () {
        Route::get('getList', 'Language/getList');
        Route::post('doAdd', 'Language/doAdd');
        Route::post('doEdit', 'Language/doEdit');
        Route::post('doDelete', 'Language/doDelete');
    });

    // 字典管理
    Route::group('dict', function () {
        Route::get('getList', 'Dict/getList');
        Route::post('doAdd', 'Dict/doAdd');
        Route::post('doEdit', 'Dict/doEdit');
        Route::post('doDelete', 'Dict/doDelete');
    });

    // 监控管理
    Route::group('monitor', function () {
        Route::get('getSystemInfo', 'Monitor/getSystemInfo');
        Route::get('getMemoryInfo', 'Monitor/getMemoryInfo');
        Route::get('getDiskInfo', 'Monitor/getDiskInfo');
        Route::get('getGpuInfo', 'Monitor/getGpuInfo');
        Route::get('getMotherboardInfo', 'Monitor/getMotherboardInfo');
        Route::get('getCpuInfo', 'Monitor/getCpuInfo');
        Route::get('getServiceInfo', 'Monitor/getServiceInfo');
    });
})->middleware(['auth', 'log']);
